<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>Hello, World</title>
  <style type="text/css">
    html {
      width:100%;
      height:100%;
    }

    body {
      height: 100%;
      margin: 0px;
      padding: 0px
    }

    #container {
      height: 98%
    }
  </style>
  <script src="js/jquery.min.js"></script>
  <script src="js/bmap_init.js">
  </script>
  <script type="text/javascript" src="js/bmap_offline_api_v3.0_min.js"></script>
  <script type="text/javascript" src="js-event-bus.min.js"></script>
  <!-- 离线地图功能逻辑处理JS -->
  <script src="/static/bmap/js/gisPick.js"></script>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">

  var eventBus = new EventBus();
  var map = new BMap.Map('container')
  var position = ''

  var point = new BMap.Point(117.75022, 30.78906)  // 创建点坐标
  map.centerAndZoom(point, 12)                 // 初始化地图，设置中心点坐标和地图级别
  //添加地图类型控件
  map.addControl(new BMap.MapTypeControl({
    mapTypes: [
      BMAP_NORMAL_MAP,
      BMAP_HYBRID_MAP
    ]
  }))
  map.setCurrentCity('安庆市')          // 设置地图显示的城市 此项是必须设置的
  map.enableScrollWheelZoom(true)     //开启鼠标滚轮缩放
  //单击获取点击的经纬度
  map.addEventListener('click', function(e) {
    //alert(e.point.lng + "," + e.point.lat);
    position = e.point.lng + ',' + e.point.lat;
    eventBus.emit('sendGis', null, position);
  });

  function pickgis(callback) {
    if(callback) {
      eventBus.on('sendGis', function (params) {
        callback(params)
      })
    }
  }
</script>
</body>
</html>
